<%@ page language="java" pageEncoding="utf-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path;
    request.setAttribute("ctx", basePath);
%>


<link href="${ctx}/static/js/plugins/zanedatatime/dist/zane-calendar.min.css" rel="stylesheet">
<link href="${ctx}/static/css/bootstrap.min.css" rel="stylesheet">
<link href="${ctx}/static/css/font-awesome.min.css" rel="stylesheet">
<link href="${ctx}/static/css/animate.css" rel="stylesheet">
<link href="${ctx}/static/css/style.css" rel="stylesheet">
<link href="${ctx}/static/css/login.css" rel="stylesheet">
<link href="${ctx}/static/css/toastr.css" rel="stylesheet">
<link href="${ctx}/static/ruoyi/css/ry-ui.css" rel="stylesheet">
<link href="${ctx}/static/js/plugins/bootstrapTable/dist/bootstrap-table.css" rel="stylesheet">
<link href="${ctx}/static/ajax/libs/datapicker/bootstrap-datetimepicker.css" rel="stylesheet">
<link href="${ctx}/static/js/plugins/ztree/css/metro/zTreeStyle.css" rel="stylesheet">

<!-- 全局js -->
<script src="${ctx}/static/js/jquery.min.js"></script>
<script src="${ctx}/static/js/bootstrap.min.js"></script>
<script src="${ctx}/static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="${ctx}/static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="${ctx}/static/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="${ctx}/static/ajax/libs/layer/layer.min.js"></script>
<script src="${ctx}/static/ruoyi/js/ry-ui.js"></script>
<script src="${ctx}/static/ruoyi/index.js"></script>
<script src="${ctx}/static/ajax/libs/fullscreen/jquery.fullscreen.js"></script>
<script src="${ctx}/static/js/toastr.js"></script>
<script src="${ctx}/static/js/plugins/bootstrapTable/src/bootstrap-table.js"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="${ctx}/static/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="${ctx}/static/ajax/libs/validate/messages_zh.min.js"></script>
<script src="${ctx}/static/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="${ctx}/static/js/plugins/zanedatatime/dist/zane-calendar.min.js"></script>
<script src="${ctx}/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<script src="${ctx}/static/js/plugins/ztree/js/jquery.ztree.all-3.5.js"></script>
<script>
    $(function () {
        //参数设置，若用默认值可以省略以下面代
        toastr.options = {
            "closeButton": true, //是否显示关闭按钮

            "positionClass": "toast-top-right",//弹出窗的位置

            "showDuration": "300",//显示的动画时间

            "hideDuration": "1000",//消失的动画时间

            "timeOut": "1500", //展现时间

            "showEasing": "swing",//显示时的动画缓冲方式

            "hideEasing": "linear" //消失时的动画缓冲方式

        };


        //手机号码验证
        jQuery.validator.addMethod("isMobile", function (value, element) {
            var length = value.length;
            var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
            return this.optional(element) || (length == 11 && mobile.test(value));
        }, "请正确填写手机号码");

        Date.prototype.Format = function (fmt) { //author: meizz
            var o = {
                "M+": this.getMonth() + 1,                 //月份
                "d+": this.getDate(),                    //日
                "h+": this.getHours(),                   //小时
                "m+": this.getMinutes(),                 //分
                "s+": this.getSeconds(),                 //秒
                "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                "S": this.getMilliseconds()             //毫秒
            };
            if (/(y+)/.test(fmt))
                fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            for (var k in o)
                if (new RegExp("(" + k + ")").test(fmt))
                    fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
            return fmt;
        }
    });


    function timeFn(d1, d2) {//di作为一个变量传进来
        //如果时间格式是正确的，那下面这一步转化时间格式就可以不用了
        var dateBegin = new Date(d1.replace(/-/g, "/"));//将-转化为/，使用new Date
        var dateEnd = new Date(d2.replace(/-/g, "/"));//获取当前时间
        var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数
        var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000));//计算出相差天数
//        var leave1 = dateDiff % (24 * 3600 * 1000)    //计算天数后剩余的毫秒数
//        var hours = Math.floor(leave1 / (3600 * 1000))//计算出小时数
//        //计算相差分钟数
//        var leave2 = leave1 % (3600 * 1000)    //计算小时数后剩余的毫秒数
//        var minutes = Math.floor(leave2 / (60 * 1000))//计算相差分钟数
//        //计算相差秒数
//        var leave3 = leave2 % (60 * 1000)      //计算分钟数后剩余的毫秒数
//        var seconds = Math.round(leave3 / 1000)
         return dayDiff;
    }


</script>